____ _ _ _ _
| _ \ ___ | |_ (_) _ __ ___ __| | (_) __ _
| |_) | / _ \ | __| | | | '_ \ / _ \ / _| | | | / _ |
| _ < | __/ | |_ | | | |_) | | __/ | (_| | | | | (_| |
|_| \_\ \___| \__| |_| | .__/ \___| \__,_| |_| \__,_|
|_|
- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b- `b
Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―Β―
Functional Programming System
part 3/5 Β· 14.8 KB total
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
I P ( β¨ β¨ β¨ β¨ 1 , 2 , 3 β© β© , β¨ β¨ 6 , 5 , 4 β© β© β© β© ) = ( ( / + ) β β ( Ξ± Ξ± Γ Γ ) β β T r a n s ) ( β¨ β¨ β¨ β¨ 1 , 2 , 3 β© β© , β¨ β¨ 6 , 5 , 4 β© β© β© β© ) = ( ( / + ) β β ( Ξ± Ξ± Γ Γ ) ) ( T r a n s ( β¨ β¨ β¨ β¨ 1 , 2 , 3 β© β© , β¨ β¨ 6 , 5 , 4 β© β© β© β© ) = ( / + ) ( ( Ξ± Ξ± Γ Γ ) ( β¨ β¨ β¨ β¨ 1 , 6 β© β© , β¨ β¨ 2 , 5 β© β© , β¨ β¨ 3 , 4 β© β© β© β© ) = ( / + ) ( β¨ β¨ Γ Γ ( β¨ β¨ 1 , 6 β© β© ) , Γ Γ ( β¨ β¨ 2 , 5 β¨ β¨ ) , Γ Γ ( β¨ β¨ 3 , 4 β© β© ) β© β© = ( / + ) ( β¨ β¨ 6 , 10 , 12 β© β© ) = + ( β¨ β¨ 6 , + ( β¨ β¨ 10 , 12 β© β© ) β© β© = 28 {\displaystyle {\begin{aligned}&\mathrm {IP} (\langle \langle 1,2,3\rangle ,\langle 6,5,4\rangle \rangle )\\&=((/+)\circ (\alpha \times )\circ \mathrm {Trans} )(\langle \langle 1,2,3\rangle ,\langle 6,5,4\rangle \rangle )\\&=((/+)\circ (\alpha \times ))(\mathrm {Trans} (\langle \langle 1,2,3\rangle ,\langle 6,5,4\rangle \rangle )\\&=(/+)((\alpha \times )(\langle \langle 1,6\rangle ,\langle 2,5\rangle ,\langle 3,4\rangle \rangle )\\&=(/+)(\langle \times (\langle 1,6\rangle ),\times (\langle 2,5\langle ),\times (\langle 3,4\rangle )\rangle \\&=(/+)(\langle 6,10,12\rangle )\\&=+(\langle 6,+(\langle 10,12\rangle )\rangle \\&=28\end{aligned}}}
Der Rechenprozess stellt also eine Verarbeitungspipeline ohne inneren Zustand dar, der die Eingabe in drei getrennten Arbeitsschritten in die Ausgabe ΓΌberfΓΌhrt. Die Arbeitsschritte selbst kΓΆnnen fΓΌr sich in unterschiedlichem Grad parallelisiert werden. Auch die Erstellung einer Hardware-Pipeline fΓΌr das Programm I P {\displaystyle IP} wΓ€re mΓΆglich.
Notationen im FP-System
Backus verwendet eine lose an mathematische Konventionen angelehnte Notation und ergΓ€nzt diese um McCarthy'sche bedingte AusdrΓΌcke sowie eine rekursive Darstellung fΓΌr WHILE-Schleifen. Entscheidend ist, dass jede EntitΓ€t eine Funktion darstellt und damit mit dem Kompositionsoperator β β {\displaystyle \circ } vertrΓ€glich ist.
Zahlen als Selektoren
Die Vektorprogrammiersprache APL hatte einen entscheidenden Einfluss auf das Combinator based functional programming system von John Backus, das ohne Lambda-Variablenliste auskommt; stattdessen werden Selektoren (Zahlen) fΓΌr das Herauspicken von Werten aus einer Sequenz verwendet.
1:<x1,β¦,xn> β x1
i:<x1,β¦,xi,β¦,xn> β xi
| Combining β¦ | β¦ Form | |
|---|---|---|
| Applikation | f : x | = f(x) |
| Komposition | (f o g) : x | = f(g(x)) |
| Konstruktion | [ f 1 , f 2 , β¦ , f n ] : x | = < f 1 :x , f 2 :x , β¦ , f n :x > |
| Kondition | (p β f ; g) : x | = wenn p:x = T dann f:x sonst wenn p:x = F dann g:x sonst β₯ |
| Konstante | ~ x : y | = wenn y = β₯ dann β₯ sonst x |
| Insert | ( / f) : < x 1 , x 2 , β¦ , x n > | = f: < x 1 , f: < x 2 , β¦ f: < x n-1 , x n >>> |
| Apply to All | ( Ξ± f) : < x 1 , x 2 , β¦ , x n > | = < f:x 1 , f:x 2 , β¦ , f:x n > |
| Binary to Unary | bu f x | |
| While-Schleife | ( while p f) : x | = wenn p:x = T dann ( while p f) : (f : x) sonst wenn p:x = F dann x sonst β₯ |
und die Definition von monadischen Funktionen:
Def Name β‘ Term
Mit β₯ meinte Backus den Wert βBottomβ, ein Wert wie βundefiniertβ oder βAusnahmeβ. T und F sind die Werte fΓΌr βwahrβ und βfalschβ.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ